package com.prik.strategy.discount;

import java.math.BigDecimal;

/**
 * 上下文类
 *
 * @author prik
 * @date 2019/7/18
 */
public class DiscountContext {
    private static DiscountStrategyFactory strategyFactory = DiscountStrategyFactory.getInstance();

    public BigDecimal calDiscountPrice(BigDecimal originalPrice, int customerType) {
        DiscountStrategy strategy = strategyFactory.creator(customerType);
        return strategy.calDiscountPrice(originalPrice);
    }
}
